home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / PictUtil.h < prev    next >
Text File  |  1991-04-17  |  5KB  |  168 lines

  1. /*
  2.     File:        PictUtil.h
  3.  
  4.     Contains:    C-Style headers for the picture utilities package
  5.  
  6.     Copyright:    © 1990 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10.  
  11. #ifndef __PICTUTIL__
  12. #define __PICTUTIL__
  13.  
  14. #ifndef __TYPES__
  15. #include <Types.h>
  16. #endif
  17.  
  18. #ifndef __PALETTES__
  19. #include <Palettes.h>
  20. #endif
  21.  
  22. /*----------------------------------------------------------------------------------------------------------*/
  23.  
  24. /* verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls */
  25.  
  26. #define returnColorTable            ( (short) 0x0001 )
  27. #define    returnPalette                ( (short) 0x0002 )
  28. #define    recordComments                ( (short) 0x0004 )
  29. #define    recordFontInfo                ( (short) 0x0008 )
  30. #define    suppressBlackAndWhite        ( (short) 0x0010 )
  31.  
  32.  
  33. /* color pick methods */
  34.  
  35. #define systemMethod                0
  36. #define    popularMethod                1
  37. #define medianMethod                2
  38.  
  39.  
  40. /* color bank types */
  41.  
  42. #define ColorBankIsCustom            -1
  43. #define ColorBankIsExactAnd555        0
  44. #define ColorBankIs555                1
  45.  
  46.  
  47. /*----------------------------------------------------------------------------------------------------------*/
  48.  
  49. /*
  50. |    Data Structures
  51. */
  52.  
  53. struct CommentSpec {
  54.  
  55.     short            count;                        /* number of occurrances of this comment ID */
  56.     short            ID;                            /* ID for the comment in the picture */
  57.  
  58. };
  59. typedef    struct CommentSpec CommentSpec;
  60. typedef    CommentSpec *CommentSpecPtr, **CommentSpecHandle;
  61.  
  62.  
  63. struct FontSpec {
  64.  
  65.     short            pictFontID;                    /* ID of the font in the picture */
  66.     short            sysFontID;                    /* ID of the same font in the current system file */
  67.     long            size[4];                    /* bit array of all the sizes found (1..127) (bit 0 means > 127) */
  68.     short            style;                        /* combined style of all occurrances of the font */
  69.     long            nameOffset;                    /* offset into the fontNamesHdl handle for the font’s name */
  70.  
  71. };
  72. typedef    struct FontSpec FontSpec;
  73. typedef    FontSpec *FontSpecPtr, **FontSpecHandle;
  74.  
  75.  
  76.  
  77. struct  PictInfo {
  78.  
  79.     short                version;                /* this is always zero, for now */
  80.     long                uniqueColors;            /* the number of actual colors in the picture(s)/pixmap(s) */
  81.     PaletteHandle        thePalette;                /* handle to the palette information */
  82.     CTabHandle            theColorTable;            /* handle to the color table */
  83.     Fixed                hRes;                    /* maximum horizontal resolution for all the pixmaps */
  84.     Fixed                vRes;                    /* maximum vertical resolution for all the pixmaps */
  85.     short                depth;                    /* maximum depth for all the pixmaps (in the picture) */
  86.     Rect                sourceRect;                /* the picture frame rectangle (this contains the entire picture) */
  87.     long                textCount;                /* total number of text strings in the picture */
  88.     long                lineCount;                /* total number of lines in the picture */
  89.     long                rectCount;                /* total number of rectangles in the picture */
  90.     long                rRectCount;                /* total number of round rectangles in the picture */
  91.     long                ovalCount;                /* total number of ovals in the picture */
  92.     long                arcCount;                /* total number of arcs in the picture */
  93.     long                polyCount;                /* total number of polygons in the picture */
  94.     long                regionCount;            /* total number of regions in the picture */
  95.     long                bitMapCount;            /* total number of bitmaps in the picture */
  96.     long                pixMapCount;            /* total number of pixmaps in the picture */
  97.     long                commentCount;            /* total number of comments in the picture */
  98.     long                uniqueComments;            /* the number of unique comments in the picture */
  99.     CommentSpecHandle    commentHandle;            /* handle to all the comment information */
  100.     long                uniqueFonts;            /* the number of unique fonts in the picture */
  101.     FontSpecHandle        fontHandle;                /* handle to the FontSpec information */
  102.     Handle                fontNamesHandle;        /* handle to the font names */
  103.     long                reserved1;
  104.     long                reserved2;
  105.  
  106. };
  107. typedef    struct PictInfo PictInfo;
  108. typedef    PictInfo *PictInfoPtr,**PictInfoHandle;
  109.  
  110. typedef    long PictInfoID;
  111.  
  112.  
  113. #ifdef __cplusplus
  114. extern "C" {
  115. #endif
  116.  
  117. pascal OSErr GetPictInfo        (    PicHandle        thePictHandle, 
  118.                                     PictInfo        *thePictInfo,
  119.                                     short            verb,
  120.                                     short            colorsRequested,
  121.                                     short            colorPickMethod,
  122.                                     short            version
  123.                                 ) = { 0x303C, 0x0800, 0xA831 };
  124.  
  125.  
  126. pascal OSErr GetPixMapInfo        (    PixMapHandle    thePixMapHandle, 
  127.                                     PictInfo        *thePictInfo,
  128.                                     short            verb,
  129.                                     short            colorsRequested,
  130.                                     short            colorPickMethod,
  131.                                     short            version
  132.                                 ) = { 0x303C, 0x0801, 0xA831 };
  133.  
  134.  
  135. pascal OSErr NewPictInfo        (    PictInfoID        *thePictInfoID,
  136.                                     short            verb,
  137.                                     short            colorsRequested,
  138.                                     short            colorPickMethod,
  139.                                     short            version
  140.                                 ) = { 0x303C, 0x0602, 0xA831 };
  141.  
  142.  
  143. pascal OSErr RecordPictInfo        (    PictInfoID        thePictInfoID,
  144.                                     PicHandle        thePictHandle
  145.                                 ) = { 0x303C, 0x0403, 0xA831 };
  146.  
  147.  
  148. pascal OSErr RecordPixMapInfo    (    PictInfoID        thePictInfoID,
  149.                                     PixMapHandle    thePixMapHandle
  150.                                 ) = { 0x303C, 0x0404, 0xA831 };
  151.  
  152.  
  153. pascal OSErr RetrievePictInfo    (    PictInfoID        thePictInfoID,
  154.                                     PictInfo        *thePictInfo,
  155.                                     short            colorsRequested
  156.                                 ) = { 0x303C, 0x0505, 0xA831 };
  157.  
  158.  
  159. pascal OSErr DisposPictInfo        (    PictInfoID        thePictInfoID
  160.                                 ) = { 0x303C, 0x0206, 0xA831 };
  161.  
  162.  
  163. #ifdef __cplusplus
  164. }
  165. #endif
  166.  
  167. #endif
  168.